package image;

import image.GisImage;

import java.awt.image.BufferedImage;
import java.io.FileInputStream;
import java.io.IOException;

import javax.imageio.ImageIO;

public class WebImage implements GisImage {

	public final static int SUBWAY = 0;
	public final static int LETTER = 1;
	private static int[] buff = null;
	private static int width = 0;
	private static int height = 0;
	private int n = -1;
	
	public int getWidth() {
		return 16;
	}
	
	public WebImage(int np){
		n = np;
		if(buff == null){
			BufferedImage i = null;
			try {
				i = ImageIO.read(new FileInputStream("res/webimages.png"));
			} catch (IOException e) {
				e.printStackTrace();
			}
			width = i.getWidth(null);
			height = i.getHeight(null);
			buff = new int[width*height];
			for(int x=0;x<width;x++)
				for(int y=0;y<height;y++)
					buff[x+y*width] = i.getRGB(x, y);
		}
	}

	public int getHeight() {
		return 16;
	}

	public int getXoff() {
		return width;
	}

	public int[] getBuff() {
		return buff;
	}

	public int getXInitOff() {
		return 16*n;
	}

	public int getYInitOff() {
		return 0;
	}

}
